package com.fyzk.activity.app;

import android.app.ProgressDialog;
import android.content.Context;

import com.tyjc.lottery.R;


public class AppProgressDialog {
	
	private ProgressDialog dialog;
	
	public AppProgressDialog(Context context){
		initDialog(context);
	}
	
	private void initDialog(Context context){
		dialog = new ProgressDialog(context,ProgressDialog.THEME_HOLO_LIGHT);
		dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
		dialog.setCancelable(false);
		dialog.setMessage(context.getString(R.string.net_alert));
	}
	
	public void show(){
		try{
			if(!dialog.isShowing()){
				dialog.show();
			}
		}catch(Exception e){
			dialog.cancel();
		}
	}
	
	public void setContent(String message){
		dialog.setMessage(message);
	}

	
	public void cancel(){
		try{
			if(null==dialog){
				return;
			}
			if(dialog.isShowing()){
				dialog.cancel();
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
